#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// 6、将字符串中的重复字符删除，并输出新字符串。例如: gooogggle ---> 输出 gole
int main()
{
    int i = 0;
    char *str = (char *)malloc(100);
    strcpy(str, "gooogggle");
    int *length = calloc(1, 4);
    *length = strlen(str);

    while (i < *length)
    {
        int isdeletechar = 0;
        // 判断是否重复
        for (int j = 0; j < i; j++)
        {
            if (str[i] == str[j])
            {
                isdeletechar = 1;
                break;
            }
        }
        // 删除重复字符，并将字符串左移
        if (isdeletechar == 1)
        {
            for (int k = i; k < *length - 1; k++)
            {
                str[k] = str[k + 1];
            }
            (*length)--;
        }
        else
        {
            i++;
        }
    }
    str[*length] = '\0';
    printf("%s", str);
    free(str);
    free(length);
    return 0;
}